<!-- 子组件1 -->
<template>
    <div>
        <h1> children 组件</h1>
        {{childMsg}}
        <h6>vuex的属性 {{count}}</h6>
    </div>
</template>

<script lang="ts">
import { computed, defineComponent, inject, ref, watch } from 'vue'
import { useStore }  from 'vuex'
export default defineComponent({
    name:'child',
    setup(ctx){
        console.log(ctx,'ctx')
       let childMsg = ref(inject('childMsg'))
       const store = useStore()
       let count = computed(()=>{return store.state.moduleA.num})
       console.log(store.state.moduleA,'store.state',count)
       watch(()=>count,(n,o)=>{
           console.log(n,o,'count')
       })
       return{
           childMsg,
           count
       }
    }
})
</script>

<style>

</style>